package com.cy.sp04.feign;

import com.cy.sp01.pojo.Item;
import com.cy.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

//@FeignClient调用服务的配置
//name属性指定注册服务中主机地址
@FeignClient(name = "item-service")
public interface ItemClient{

    //获取订单的商品列表
    //指定调用的地址
    @GetMapping("/{orderId}")
    JsonResult<List<Item>> getItems(@PathVariable String orderId);

    //减少商品库存
    @PostMapping("/decreaseNumber")
    JsonResult<?> decreaseNumber(@RequestBody List<Item> items);

}
